<template>
	<view class="content">
		<view class="title">重要提醒</view>
		<view class="logoff-top">注销帐号是不可恢复的操作，注销后，您将无法再使用本账号相关的任何内容或信息，包括但不限于:</view>
		<view class="logoff-text">1、您将无法登录，使用本账号，您的个人资料和历史信息将无法找回</view>
		<view class="logoff-text">2、您的订单记录、浏览记录将会被清空，并无法找回</view>
		<view class="logoff-text">3、您将被解除在貘鱼自助上享有的所有权利</view>
		<view class="flexWarpCenterColumn bottom-box">
			<view class="protocol-box flexWrapNo" @tap="changeCheck()">
				<view class="cheack" :class="{cheackd:check}"></view>
				我已阅读并同意注销账号
			</view>
			<view class="btn" @tap="logoff">注销账号</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				check:false
			};
		},
		methods:{
			changeCheck(){
				this.check=!this.check
			},
			logoff(){
				if(!this.check){
					this.$tools.showToast('请先同意')
					return;
				}
				this.$request.post(this.$api.logoff, {}, {
					token:true
				}).then(res => {
					let {
						data = {}
					} = res;
					if (res.code==1) {
						this.$tools.showToast('注销成功')
						uni.removeStorageSync('token') // 清除登录token
						setTimeout(()=>{
							uni.reLaunch({
								url:'/pages/login/launch'
							})
						},1000)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.content{
		padding: 30upx;
		color: #fff;
	}
	.title{
		text-align: center;
		font-size:36upx;
		margin-bottom: 20upx;
	}
	.logoff-top{
		font-size:30upx;
		line-height: 50upx;
		margin-bottom: 30upx;
	}
	.logoff-text{
		font-size:28upx;
		line-height: 50upx;
	}
	.bottom-box{
		position: fixed;
		left: 0;
		right: 0;
		bottom: 64upx;
		margin: auto;
		.protocol-box{
			font-size: 24rpx;
			font-family: PingFang SC-Regular, PingFang SC;
			font-weight: 400;
			color:#BABABA;
			margin-top: 30upx;
			.cheack{
				width: 32rpx;
				height: 32rpx;
				margin-right: 16rpx;
				border: 1rpx solid #BABABA;
				border-radius: 50%;
			}
			.cheackd{
				width: 36rpx;
				height: 36rpx;
				background: url('../static/select-icon.png') no-repeat center/100% 100%;
				border: none;
			}
			text{
				color: #26BCFD;
			}
		}
		.btn{
			width: 694rpx;
			height: 144rpx;
			line-height: 144rpx;
			background: linear-gradient( 90deg, #4AA22A 0%, #69D037 100%);
			border-radius: 72rpx;
			font-size: 36upx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			text-align: center;
			margin-top: 20upx;
		}
	}
</style>
